﻿@model AccountViewModel
@{
    var parent = (WebViewPage)TempData["Parent"];

    if (Model.IsOrganization)
    {
        ViewBag.UnconfirmedEmailAddressMessage = "This is a preview of how the profile picture will look once the organization email address is verified.";
        ViewBag.GravatarProfileMessage = "We use the organization's name and its verified email address to get its publicly visible Gravatar profile picture "
            + "(or a default image if it does not have a Gravatar profile picture). Please go to {0} to change the profile picture for your organization.";
    }
    else
    {
        ViewBag.UnconfirmedEmailAddressMessage = "This is a preview of how your profile picture will look once you have verified your current email address.";
        ViewBag.GravatarProfileMessage = "We use your public profile name and your verified email address to get your publicly visible Gravatar profile picture "
                + "(or a default image if you have not set up a Gravatar profile picture). Please go to {0} to change your profile picture.";
    }
}

@helper GravatarLink(string text)
{
    <a href="http://www.gravatar.com" target="_blank">@text</a>
}

@ViewHelpers.Section(parent,
    "profile-picture",
    @<text>Profile Picture @(Model.HasUnconfirmedEmailAddress ? "(preview)" : string.Empty)</text>,
    @<text>
        @ViewHelpers.GravatarImage(
            Url,
            Model.CurrentEmailAddress,
            Model.AccountName,
            GalleryConstants.GravatarElementSize)
    </text>,
    @<text>
        @if (Model.HasUnconfirmedEmailAddress)
        {
            <p>@ViewBag.UnconfirmedEmailAddressMessage</p>
        }

        @Html.Raw(string.Format(@ViewBag.GravatarProfileMessage,
             GravatarLink("gravatar.com")))
    </text>,
    disabled: !Model.CanManage)

